package com.itheima.controller;

import com.itheima.domain.mongo.Comment;
import com.itheima.service.mongo.CommentService;
import com.itheima.vo.PageBeanVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
public class CommentController{

    @Autowired
    private CommentService commentService;

    @PostMapping("/saveMovementComment")
    public Integer saveMovementComment(@RequestBody Comment comment){
        return commentService.saveMovementComment(comment);
    }

    @PostMapping("/deleteMovementComment")
    public Integer deleteMovementComment(@RequestBody Comment comment){
        return commentService.deleteMovementComment(comment);
    }

    @PostMapping("/findMovementComment")
    public PageBeanVo findMovementComment(String movementId, Integer pageNum, Integer pageSize) {
        return commentService.findMovementComment(movementId,pageNum,pageSize);
    }

    @GetMapping("/findCountComment")
    public PageBeanVo findCountComment(Long userId, Integer commentType, Integer pageNum, Integer pageSize) {
        return commentService.findCountComment(userId, commentType, pageNum, pageSize);
    }

    @PostMapping("/comment")
    public void saveVideoComment(@RequestBody Comment comment) {
        commentService.saveVideoComment(comment);
    }

    @PostMapping("/deleteVideoComment")
    public void deleteVideoComment(@RequestBody Comment comment) {
        commentService.deleteVideoComment(comment);
    }

    //视频评论列表
    @GetMapping("/findVideoComment")
    public PageBeanVo findVideoComment(String videoId, Integer pageNum, Integer pageSize) {
        return commentService.findVideoComment(videoId,pageNum,pageSize);
    }

    @PostMapping("/saveVideoCommentLike")
    public void saveVideoCommentLike(@RequestBody Comment comment) {
        commentService.saveVideoCommentLike(comment);
    }

    @PostMapping("/deleteVideoCommentLike")
    public void deleteVideoCommentLike( @RequestBody Comment comment) {
        commentService.deleteVideoCommentLike(comment);
    }

    @PostMapping("/saveMovementCommentLike")
    public Integer saveMovementCommentLike(@RequestBody Comment comment) {
        return commentService.saveMovementCommentLike(comment);
    }

    @PostMapping("/deleteMovementCommentLike")
    public Integer deleteMovementCommentLike(@RequestBody Comment comment) {
        return commentService.deleteMovementCommentLike(comment);
    }

}
